
angular.module('mamApp').factory('AuthManager', ['$http','api','paramsManager', function ($http,api,paramsManager) {
  var AuthManager = {
    /**
     * 用户登陆
     * @params json
     * eg:
     * {
         *     userName: 'XXXX',
         *     password: 'XXXX'
         *     validateCode
         *     key
         * }
     * @return json
     */
    login: function (params,key) {
      return $http.post(api+'/admin/login/login.do?key='+key, params).then(function (result) {
        return result;
      });
    },
    /**
     * 用户注册
     * @params json
     * eg:
     * {
         *
         *     password: 'XXXX'
         * }
     * @return json
     */
    sign: function (params) {
      return $http.post(api+'/cp/register/user', params).then(function (result) {
        return result;
      });
    },
    /**
     * 找回密码
     * @params json
     * eg:
     * {
         *
         *     password: 'XXXX'
         * }
     * @return json
     */
    backPassword: function (params) {
      return $http.post(api+'/cp/backPassword', params).then(function (result) {
        return result;
      });
    },
    /**
     *注册 邮箱
     * @params json
     * eg:
     * @return json
     */
    mailbox: function (params) {
      return $http.post(api+'/cp/register/userName', params).then(function (result) {
        return result;
      });
    },/**
     *修改密码 邮箱
     * @params json
     * eg:
     * @return json
     */
    mailUpdate: function (params) {
      return $http.post(api+'/cp/update/mail', params).then(function (result) {
        return result;
      });
    },
    /**
     * 邮箱验证
     * @params json
     * eg:
     * @return json
     */
    mailCheck: function (params) {
      return $http.post(api+'/cp/register/mail',params).then(function (result) {
        return result;
      });
    },
    /**
     * 修改密码
     * @params json
     * eg:
     * {
         *     oldPsw: 'XXXX',
         *     newPsw: 'XXXX'
         * }
     * @return json
     */
    resetPassword: function (params) {
      return $http.put(api+'/cp/password', params).then(function (result) {
        return result;
      });
    },
    /**
     * 获取所有的审核人员列表
     * @return json
     */
    adminList:function () {
      return $http.get(api+'/admin/manager/adminIdAndName').then(function (result) {
        return result;
      });
    }



  };
 



  return AuthManager;
}]);
